package com.scs.application.modules.base.controller;

import com.scs.application.core.model.CommonResult;
import com.scs.application.core.mvc.controller.BaseController;
import com.scs.application.core.utils.UserUtils;
import com.scs.application.modules.base.service.CertificateRepoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 资质仓库
 */
@RestController
@RequestMapping("/base/certificate")
public class CertificateRepoController extends BaseController {

    @Autowired
    private CertificateRepoService certificateRepoService;

    @GetMapping("/hospital/tree")
    public CommonResult treeForHospital(String hospitalId) {
        if (UserUtils.isHospital()) {
            hospitalId = UserUtils.getHospitalId();
        }
        return CommonResult.ok("查询成功", certificateRepoService.treeForHospital(hospitalId));
    }

    /***
     * @param
     * @date: 2024/6/24
     * @Description:  资质树
     */
    @GetMapping("/getCertTree")
    public CommonResult getCertTree(String queryType,String supplierIdFilter) {
        return CommonResult.ok("查询成功", certificateRepoService.getCertTree(queryType,supplierIdFilter));
    }
}
